added optional pos param to paste function