Made collision detection smarter