added some comments
uses compile() function to write HTML