Recursion / iteration functions. using stack/list & loop to avoid iteration