refactored init.js

Liked this plugin but found some easy-win optimizations I decided to work on:

-removed erroneous / unnecessary variable declarations
-DRYed up some repeated functions
-added constants (e.g. SMALL, LARGE)
-switch to vanilla Javascript for computationally-intensive functions
-general code cleanup for readability