More fixes and cleanup.

Change-Id: Ie520dffce67fddfe60cab62f252b3cc396f85abe