Factor rendering code out of compiler