Added module pattern to main.js