logic changed to HashMap