refactory for AddObserver
add test for observation