refactored out js