added check for existing functions