Straightening Up

Removed commented code, Split functions.js into separate files, as it
contained functions for various different scripts. Should make the code
easier to navigate and read.