non-dependent recursion, clean up of patterns