streamline into single recursive method