added sorting to the message window.