generalize method-checking routine