Moved some of the logging out of the agent class.