useful Observer pattern implementation