added dict sorting to message script