More tests, and some null checking.
More null checks.