Switch around key and index in key and charcode lookup