Adopted the observer pattern.