save pattern funct