Spruced up code

Made it more jshint friendly. Also, refactored quite a lot of code.
Also, can you please change the version to 0.5