Made morse_dict global to avoid reassignment on each call.