Modularize to enable easier testing

Change-Id: I85c5d95658c0be57c4ce87fac53556475ae53207
Merge "Modularize to enable easier testing"