HTML tests and refactoring