changeAgentSpeed function added