Finish non-recursive generate function