Added function to check overlap, needs brushup