added collisions and a little more code