Improve efficency of collision checking to nlogn