Added a check for function existence