some collision detection and other stuff