Refactored UserManager and MessageManager into Singleton for thread safety