Refactored the client into a widget