Refactored copyCmd