refactoring html + js