Completed refactoring.
Now the client knows about the gui and vice versa