i appear to have a recursive function and bad logic now fixed