Index: branches/LCSv2/controllers/default.py
===================================================================
--- branches/LCSv2/controllers/default.py	(revision 636)
+++ branches/LCSv2/controllers/default.py	(revision 641)
@@ -1,5 +1,5 @@
 # added comments for testing
 # Constants
-kLogfile = "samplelogfile.txt"
+kLogfile = "LCSlogfile.txt"
 kSimtimefile = "sim_elapsedtime.json"  #"../webapps/dynamicdata/sim_elapsed_time.json"
 hwys = ['','1','5', '22', '55', '57', '73', '74', '91', '133', '142', '241', '261', '405', '605']
@@ -7,9 +7,15 @@
 # Names to appear in the username dropdown box
 users = []
+users.append('')
 # Show the login page
 def index():
     userfile = open('student_names.txt','r')
-    users = [line.strip() for line in userfile.readlines()]
-    users.insert(0,'')
+    # read the file into a buffer
+    buffer = [line.strip() for line in userfile.readlines()]
+    # Append each name in the buffer to the users list, skipping blank lines
+    for item in buffer:
+        if len(item) > 0:
+            users.append(item)
+    # build the form
     form = FORM(LABEL('User:',_for='username', _class="label username-label"),
                 #INPUT(_name='username', _size='15', _style="font-size: 18px;"), BR(),
@@ -18,5 +24,5 @@
     if form.process().accepted:
         # Put the username entry into the session variable
-        session.username = form.vars.username
+        session.username = reverseNameFields(form.vars.username)
         redirect(URL('home'))
     return dict(form=form)
@@ -376,4 +382,14 @@
         return "NO"
 
+# Swap the fields in a name, changing lastname first to firstname first.
+def reverseNameFields(formattedname):
+    # Divide the name into last and first names
+    x = formattedname.split(',')
+    # If there isn't a comma, return the entire name
+    if len(x) == 1:
+        return x[0].strip()
+    else:  # return the swapped fields
+        return x[1].strip() + ' ' + x[0]
+
 # Convert the lanes closed checkboxes into a human readable string
 # E.g.  #1 #3 of 4
