Update docs and move some code around

Change-Id: I02f833688bfcac74137eed68343e5735d1aeff71