added map as argument to function