Updated for beta5. Added explicit nil checks and use the nil coalescing operator.