Clean up rendering code