Cleans up code

Adds comments, semi-colons after event functions in JS, and whitespace
Fixes sorting in upcoming view

Sort function needed to return 1 or -1 as opposed to true or false