Implement replace and replace-box

Signed-off-by: Ari Rahikkala <ari.rahikkala@gmail.com>