Collision detection

Many thanks for this, much appreciated.