added loop through table logic to pasteget