Refactor clipboard management and add some features