Split out some of the rendering logic from the main logic.