updated js to work with or without requireJs