Small code-cleanup.

This removes an unused method and cleans up duplicate code.

Change-Id: Ic3be1cf49b391c6bfc89b59535802e633666fecb