refactor of ally collision ai