modified render loop