copy to clipboard code, almost done