new restoring alg
work in progress