added isValid implementation