changed search method to use a hash map instead