Use hashmap instead of arraylist