Updates for checking that checkout succeeded

Also a bit of restructuring and commenting.

Change-Id: Id618e7fbfb246c316ad297307ee7829dba68aa00