add recursion and update docs