Refactor username -> agentName where appropriate