Refactoring HTML/JS