Add recursive mapping algorithm