Some minor refactoring and a major fix for fladistctapp, where
Selenium is an unfortunate evil.
(cherry picked from commit ccaa35b)