recursive implementation
Merge pull request #1 from wmax641/master

recursive implementation