Refactors JavaScript to be modularized

Refactors JavaScript into an "instructions" module to avoid polluting
the global scope with properties. Also moves nested functions to the
module scope and establishes public/private scope of module properties
and methods.
Merge pull request #2 from anselmbradford/js-formatting

Refactors JavaScript to be modularized