minor formatting stuff
refactored the javascript