refactoring for simplicity