Use boolean flag to avoid comparison duplication
Merge pull request #369 from Dmitry-Me/useBoolFlagToAvoidComparisonDuplication

Use boolean flag to avoid comparison duplication