imporved colision detection