Sort states and comments in chronological order