refactoring: simplify this code