Replace duplications with metaprogramming incantations