updated copy paste function