use hash table lookup insted of loop for exact search