started rewriting the html write method