We should be using the `defined` function everywhere instead of `typeof`.