refactor javascript, remove need for require.js