Change vector to map for storing history states