Code restructuring and Selenium for GUI tests