Implements recursion