Attempt at implementing collision detection