Refactoring attempt.

Change-Id: I728619b875dc659a7a0eca4c877f580672357206