optimize collision detection while keeping it mostly perfect