Move js to main.js and minor cosmetic cleanup