First pass refactor of Rendering code