@cressie176 adding an alternative non-recursive api