refactored/cleaned up JS w/module patterns