Move rendering code to its own namespace