refactored some code (mainly html)