Optimizing buffer