Implement a generic output buffer for both programs.