Converted recursive algorithm to iterative
Tests with caching and fine tunning of transitions
Merge remote-tracking branch 'origin/master' into gh-pages