Pyflakes fixes

I made few small fixes - mostly pyflakes reports of unused variables and imports.

There are still paces where pyflakes is showing an error (unbound variable) but I don't really know how to fix them.