added JS to all pages and code cleanup
Merge branch 'code_cleanup_and_comments'