Fix GUI on Linux; refactor