Refactoring JS and Modify CSS