Cleaned up recursive method.