Adds JSHint to the build system and tidies up code.