Major rewrite to use the interval-set and isometry packages.