added scratch buffer.