output_buffer, change out parameters to pointers, todo: catch