Stop it from getting too close to target (added missing code snippets).