improved:
validate input modules in source file
use valid values in mod array instead of partially search/replaced ones
use @INC if not found in source file