Moved the buffer edition into dedicated functions.