adding validation code and cleaning up cfgs