Refactoring JS and remove dependencies