Added isDefined function