Refactor form controllers in separate file.
Fix flake8 errors.