added colision detection