rewrite serv2mat