finally got hash map to work with linear time