Added IsValid check