Added code for determining overlaps