Sacrifice some micro-optimization to remove duplicate code
Merge pull request #2430 from SHyx0rmZ/remove-duplicate

Sacrifice some micro-optimization to remove duplicate code