Fixes #10. I updated the code based on Jshint messages.