Clean-up and refactoring

Change-Id: I885dae4d678309c425b660f887c729a7ebd5707d