Changed the ChatMessage class variables to private and modified the code to use getters instead