HTML mending and code clean up