Refactor js in general

![](http://media.giphy.com/media/AR6UG2hZ19Yru/giphy.gif)
My favorite pull request of all time