revise BuildCodebook