further simplified recursion
simplified apply rule logic