Added tests for collision detection. Simplified collision detection for most cases.