Change sorting method in messages array