Fix docstring stuff. Refactor recursion