Refactored clipboard support