modularizing javascript