Rewrite graph copy in a simpler way
Remove useless temporary variables