Rewriting for multiple metrics