Some refactoring of the rendering code that hopefully will help out…