Refactor pb