Add observer pattern code