replaced use of function as executes on master instead of agent.