Added requireJS support

Improved dependencies and file structure.