refactoring for more clear code