Fix various code smells

Change-Id: Id2db5296fdfe590e89ba3168079d672249228f34