refactor pb