modularize javascript