refactoring observer