Refactoring HTML / js