Improvements for assistant workflow

The commits contain lots of PEP8 refactoring so it maybe difficult too see the changes in the diff. Read the commit messages and code changes simultaneously to get clearer picture of the changes.