they are not removed from the $messages array but a copy of the with all remaining messages is returned.