Add function exists checks to prevent redeclare errors.