Start to move logic out of the agent