change HashMap reference to Map reference