I like your coding style, but it might be annoying to type. I edited the if after if after if into a switch statement etcetera. There's a comment after the imports.
ALSO, to get the strings from the array, you use texts[index]
Efficiency is one of the key parts of why programming is a nightmare.