Editted checkvalid method, still not functional