Remove duplicated code
Fix up jshint errors
Merge pull request #31 from imduffy15/master

Remove duplicated code