Manage ref and non-ref functions