refactoring of pbc integration