Optimized mode fxn