Replaced return null with Exceptions.
Ignored defaults in switch cases, and != null checks. Included comments.