recursive method works, still slow, buggy