refactoring connection computations in agree