added simple message sorting