would it not make sense to replace the part of the function above this with the getMessageQueue() function which will get the messages in exactly the same way?