Added function code to copyBlock.