buffer and datathread added