Implementing observer pattern