Ported combined input for fixing #2

This is the initial commit of parts of the old code that didn't make it into OSS.