algorithm switch script