Simplify onFrame algo