Added waiting for data before parsing incoming data