changed to use hashmap