Done some refactoring

Change-Id: I620743dfc5e7ff7f623664596b58378635ee4c25