Cleanups import and unused variables, fix typo (min -> max).

I did some cleanups, found a typo (min vs max) and the editor triggered some white-space removal too.