First attempt
Fixed sorting
Fixed tests and increased perf on pairs sorting
Fixed tests and more optimizations
Removed extra iterations
Small code refactoring
Small code refactoring
Code refactoring
Merge pull request #2 from a-ignatov-parc/optimization-round

Another performance optimizations