Better collision detection, minor changes