refactored into new js folder