Added some validation and tests.