Added requirejs build task, some refactoring:

- Dev and prod require.js tasks
- Refactored some code and comments