Updated observer function