Add support for replace command

And improve documentation