Few cleanup changes, and changes for restoring