messages cleaned up and synchronized by line numbers