Added better handling for expansionChar being a multi-character string.