index switching is working