Switch order of callback code