refactored hash functions