added write clipboard function