Implementing collision check