Adding some validation checks.