And begin cleanup of several functions in preparation for their implementation. This only reverse the control flow to use early return (and cleanup variable names and traces as it's touching entire functions anyway), so that later changes wrt IME loading / freeing would be simpler.