Adding validation and associated test cases.