Better input-update-render loop