Removed the unused pimap function, simplified other pmap code.