Refactoring of the renderer to help break dependencies and clean up the code a bit.