better refactoring