Merge pull request #4 from m101010ax/pushes

Added var to some accidentally global variables
Resolve some simple warnings detected by JSHint
Use indexOf instead of manually looping