add implementation of observer pattern