Remove 1 level of nesting from recursive method to make easier to read