rewritten; HTML output added