Adds message handlers and changes protocol to be more API like