Better docstrings.
Added optional debug plotting.

Also some more tweaking of the window picking algorithm.
PEP8