refactored the JS methods - moved to separate file