Use observer pattern for cui and gui