Added sorting (based on line numbers) to the messages.