And clean up some copied around code. Bug: 17440607 Change-Id: I5cf9c58b49110c4be1a77dc9c410fedc6b99aef3