Adding restart handler for babystep giantstep