observer sample code