Add restoring root

Add restoring root and refator prepare/finish restore in machine.go

(Review request: http://reviews.vapour.ws/r/619/)