Created 2 interface for the client and ui to talk to each other

Also moved synchronized client shutdown to a shutdown method in stead of the destructor.