Algorithm fixed
Merge pull request #3 from alex-bezverkhniy/master

Algorithm complited