Improved first recursion algorithm, and deleted other methods.