todo : compare size of messages array with the current counter when adding a message
todo : compare size of messages array with the current counter when adding a message