Added methods for collison detection.