Implemented addMessage and checkMessages