Added event handling and http communication