Revert "Revert "colliison logic""

This reverts commit 022480a228a86b98524e503234e767fa2f9a3b60.