refactored main.js for jqm