Fix silly bug
Update for removal of detached ranges
Get rid of code duplication
Speed up some slow tests