cleanup and reverse messages based on modification timeg