Speed ups based on hashing