Add paste function and some cleanup.