Move cpu intensive activities out of render loop