add observer pattern codes