cleanup via flake8
Moved auto fit to its own function. Now called if no time
specified. This lets other functions (such as main) call it easier.