Speed up the agent locater, refactored it as well.