refactoring functions before ar pair integration