adding inline documentation to the javascript file
correcting which aliases are used on the second left join of the column sorting SQL