Changed all functions to MAP functions