refactor all JS to comply requirejs