Fixes and modification to cactus_realign