fixed a level error
Added requirejs
requirejs now used, also refactored some js design patterns