Moving scripts.js to an object model