Added message handler methods, ping checking.