Added check collision function