Added HTML generation, and fixed all comments.