callback should be called at the end of all recursive calls have finished