added observer pattern