Reorganised code for input configuration.

Reorganised code for input configuration.