changed to use reimplemented reorder_shells