promisified recursion for proper ordering