Refactored by Reshaper`s help