Fixed flake8 warnings, adpated tests to async architecture