Refactoring to make it easier to do multipass rendering