Refactoring: remove code duplication
Merge pull request #18 from oleksiyk/performance

Refactoring: remove code duplication