Code almost working,hashmap working as well