Refactoring

-- Now works with require.js