added the observer pattern