Task 3 completion with hashmap