Cleanup rendering code