Buffer & WriteBuffer: moved internal functions