Added better resource copying