reformat and refactor resourses.js