modularized the JS