refactoring HTML output - for now just reduce number of out.puts statements