implement isValid method