Overall code cleanup

I liked the idea of this plugin, and I may want to use this in my app at some point. However I just noticed a couple opportunities to clean up the JS abit.

The code change looks huge, but its mostly because I removed the secondary (inner) function call on defines and had to re-indent everything. It's actually a pretty small change in that regard as well.

Commit message:
* Removed the need for a double function call on define
* Improved JSHint support
* Cleaned up var definitions to top of function call