added the module pattern to organize the javascript