Added guard conditions to prevent redefinition of completion functions