Replace extensions with rewriter api