Refactoring
- use isDefined & isUndefined where needed