Reduce code duplication, cleanup variable names
Merge pull request #406 from Dmitry-Me/removeCodeDuplicationCleanupVariableNames

Reduce code duplication, cleanup variable names