restructuring code for partioning scas and dcas