js refactor
hopefully code is somewhat clearer...
Merge pull request #1 from coldclimate/master

merge from upstream
Merge pull request #6 from gotbadger/master

JS Refactor for fun