refactored recursion to use __ syntax