adds observer pattern and tests