some cleanup, wrote render_template()
a plethora of other small changes