Make split tail-recursive