add functions to parse incoming data stream