refactored code - html fixes