Code Refactor

updated js