Add repair code

Also remove lock, add config example and other minor fixes

Change-Id: I1409dd2f69372528976cadccf287fc44b8a8d99f
Merge "Add repair code"