modified to give unique function names. prefixed with oXwpgf_