Externalizing input dir to config and refactoring.