Minor refactoring on the observer code.