Make it generic with custom hash function