using afni_proc to set workflow. reorganized code