refactored user observer to remove code duplication and complexity