finished create_res and create_cfg functions