Added more parameter validations and tests.