recursion and minor fixes
updated TODO