Change indexOf to manual toggle