refactoring some js
derp