made the algorithm more complete
Merge remote-tracking branch 'origin/master'