Made the backend handle each message type separately