Move the callback up into the if else