finished fleshing out agent refactoring