added collision detecting