refactoring: code simplified