Moved recursion to separate method