adding refactors that didn't make it through last time
Merge pull request #6 from EmFoley/refactoring_js

adding refactors that didn't make it through last time