refactoring, introduce isDefined util