Fix undefined variable offset error. Whitespace fixes.
Remove stale imports. Whitespace fixes.