JS cleaned up and placed back in page.js