A compound having formula: or a pharmaceutically acceptable salt thereof wherein: R 1 is a member selected from the group consisting of hydrogen, C 1-8 alkyl, C 1-8 haloalkyl, C 3-8 cycloalkyl, and halogen; R 2 is a member selected from the group consisting of hydrogen, C 1-8 alkyl, C 3-8 cycloalkyl, C 1-8 haloalkyl, halogen, CN, and C 1-8 alkoxy; or optionally two R 2 groups on adjacent carbon atoms can be connected to form a 5 or 6 member ring (aliphatic or aromatic, heterocycle or carbocycle) which is optionally substituted with additional R 2 groups; R 3 is a member selected from the group consisting of H, C 1-4 lower alkyl and C 1 - 4 haloalkyl; R 4 is a member selected from the group consisting of H, C 1-8 alkyl, C 1-8 haloalkyl, C 1-8 hydroxyalkyl and =O; the subscripts n are each independently selected from the group consisting of 0, 1, 2 and 3; the subscript m is a member selected from the group consisting of 0, 1 and 2; each A is independently C or N, and at least one A is N; B is a member selected from the group consisting of a bond, C, C NH, C NR a, CH 2 C NH, CH 2 C NR a, NH and NR a; Q is a member selected from the group consisting of C, CH, N, O, S, S and SO 2; W, X, Y, and Z are independently C, CH, or N with the exception that Q and W may not be N in the same molecule; R 5 and R 6 are each independently absent or are a member selected from the group consisting ofH, OH, halogen, C 1-8 alkyl, C 1-8 hydroxyalkyl, C 1-8 alkoxy, C 1-8 alkyl-NH 2, -C NR a R b, -alkylene-C NR a R b, -CO 2 H and acid isosteres, -alkylene-CO 2 H and acid isosteres, -alkylene-NHC NH 2, -NR a R b, -alkylene-NR a R b, -C OR a, -alkylene-C OR a, CN, -C R a, -SO 2 R a, and -N(R a)C R b; R 7 is absent or a member selected from the group consisting of H, halogen, C 1-8 alkyl and C 1-8 haloalkyl; R 8 is absent or a member selected from the group consisting of H, OH, NH 2, NHR a, CN, C 1 - 4 aminoalkyl, C 1-4 hydroxyalkyl and C 1-4 alkyl; R 9 is absent or a member selected from the group consisting of H, C 1-4 alkyl, C 1-8 haloalkyl, CN, and -CO 2R a; R 10 is absent or a member selected from the group consisting of H, CF 3, C 1-4 alkyl and CN; and wherein R a and R b are selected from the group consisting of H, C 1-8 alkyl, heteroalkyl, C 1-8 haloalkyl, C 3-8 cycloalkyl, C 3-8 heterocycloalkyl, C 3-8 halocycloalkyl, and C 1-8 alkoxy. R 1 is a member selected from the group consisting of hydrogen, C 1-8 alkyl, C 1-8 haloalkyl, C 3-8 cycloalkyl, and halogen; R 2 is a member selected from the group consisting of hydrogen, C 1-8 alkyl, C 3-8 cycloalkyl, C 1-8 haloalkyl, halogen, CN, and C 1-8 alkoxy; or optionally two R 2 groups on adjacent carbon atoms can be connected to form a 5 or 6 member ring (aliphatic or aromatic, heterocycle or carbocycle) which is optionally substituted with additional R 2 groups; R 3 is a member selected from the group consisting of H, C 1-4 lower alkyl and C 1 - 4 haloalkyl; R 4 is a member selected from the group consisting of H, C 1-8 alkyl, C 1-8 haloalkyl, C 1-8 hydroxyalkyl and =O; the subscripts n are each independently selected from the group consisting of 0, 1, 2 and 3; the subscript m is a member selected from the group consisting of 0, 1 and 2; each A is independently C or N, and at least one A is N; B is a member selected from the group consisting of a bond, C, C NH, C NR a, CH 2 C NH, CH 2 C NR a, NH and NR a; Q is a member selected from the group consisting of C, CH, N, O, S, S and SO 2; W, X, Y, and Z are independently C, CH, or N with the exception that Q and W may not be N in the same molecule; R 5 and R 6 are each independently absent or are a member selected from the group consisting ofH, OH, halogen, C 1-8 alkyl, C 1-8 hydroxyalkyl, C 1-8 alkoxy, C 1-8 alkyl-NH 2, -C NR a R b, -alkylene-C NR a R b, -CO 2 H and acid isosteres, -alkylene-CO 2 H and acid isosteres, -alkylene-NHC NH 2, -NR a R b, -alkylene-NR a R b, -C OR a, -alkylene-C OR a, CN, -C R a, -SO 2 R a, and -N(R a)C R b; R 7 is absent or a member selected from the group consisting of H, halogen, C 1-8 alkyl and C 1-8 haloalkyl; R 8 is absent or a member selected from the group consisting of H, OH, NH 2, NHR a, CN, C 1 - 4 aminoalkyl, C 1-4 hydroxyalkyl and C 1-4 alkyl; R 9 is absent or a member selected from the group consisting of H, C 1-4 alkyl, C 1-8 haloalkyl, CN, and -CO 2R a; R 10 is absent or a member selected from the group consisting of H, CF 3, C 1-4 alkyl and CN; and wherein R a and R b are selected from the group consisting of H, C 1-8 alkyl, heteroalkyl, C 1-8 haloalkyl, C 3-8 cycloalkyl, C 3-8 heterocycloalkyl, C 3-8 halocycloalkyl, and C 1-8 alkoxy.