A little optimmization for collision detection