Storing history correctly