build control file logic