Refactor html code