speed improvemt for rectangular collision detection.