implement samerow collision function