Optimized writing to buffer, changed protocol