Implementation of copy operation.