optimized observer function