Corrected and renamed isValid method