Agent refactored to be more SOLID

Some minor breaking changes.