added more complex validation code