Corrected html and script; added sorting by username to controller