Refine buffer API