Refactor into hash specific functions