got the son-of-a-gun working, with lots of recursion