hash ref refactoring