Updated and added unit tests.  Added null checks.