observer pattern and refectoring to compostion