improved overlap detection