using defined() rather than '== undef'