simple segment improvements, but need connected component algorithm