Added randFun and refFun.