changed html writing method.