refactoring connections in AGREE