Added Activity.toHTML() and unified some code