Removed the extraction of p from iyp
Replaced print, paste and paste0 by cat and sprintf