Modified hash function