adding button state switch for index