Improved check for null or undefined.
Shortened some conditional one-liners.