'Undefined' value checking added.