sorting timed data before saving