improved collision detection, still need some testing