Removed return statement from isValid function