Refactored rendering

Still needs some major cleaning up, though