Added event handling for server responses