Otherwise, looks OK. So if you agree, move that code to where the scheduler (command queue execution) is.