refractor and refine buffer