Add wig saving code