added boundry conditions and collisions