Added dictionary and choose operator function, and rewrote the while loop to use both.