added re.design.mat function