refactoring by mari-na-bzzz