updated paste function