Minor refactoring. Few warnings fixed. Code style fixes. Import fixed

Signed-off-by: Sergey Krivohatskiy <s.krivohatskiy@gmail.com>