Some refactoring

Change-Id: I11152b82212a4e2c1719e8fc2ebf73db2ea3a65b