Refactor hash-stuff