Refactoring after Andrey comments