separate render loop from logic loop