better pasting logic