Refactor client apply p1 and gen ibf.