More general PCF function implementation