Rendering code clean up