A little refactoring of the input splitting/expansion: