And refactor some of the code to use them. Remove unused imports. Change-Id: Ica479c10247fa85c740bb99cf7d1db7fbb1b2c80