Branch/render override

@eric79 @davideaster Please review. This is the code to allow the render loop to be overridden.