Rework HTTP interface
Split rendering out to its own file