Corrections to create isValid method