Fix AMD module definitions

so that dependencies are declared through define's dependency-array
argument rather than being require()d inside define's scope
Rename main script to main.js

for better alignment with CommonJS convention