A compound of formula: or a pharmaceutically acceptable salt thereof, wherein: Z is N or CR 1, where R 1 is selected from H, halo, C 1-4 alkyl and C 1-4 haloalkyl; R 2 and R 3 are independently selected from C 1-4 alkyl and C 1-4 haloalkyl, R 4 is H or C 1-4 alkyl; X is selected from H, halo, C 1-4 alkyl, C 1-4 haloalkyl, and CN; L is selected from -C≡C-, -CR 5 =CR 6 -, -O-, -S-, and a direct bond between A and the ring containing Z; R 5 and R 6 are independently selected from H, halo, C 1-4 alkyl, and C 1-4 haloalkyl; and A is halo, CN, or an optionally substituted group selected from C 1-4 alkyl, C 3-6 cycloalkyl, phenyl, C 2-6 alkenyl, C 2-6 alkynyl, 5-6 membered heteroaryl containing up to four heteroatoms selected from N, O and S as ring members, and 4-6 membered heterocyclyl containing up to two heteroatoms selected from N, O and S as ring members, wherein the C 1-4 alkyl, C 3-6 cycloalkyl, phenyl, C 2-6 alkenyl, C 2-6 alkynyl, 5-6 membered heteroaryl containing up to four heteroatoms selected from N, O and S as ring members, and 4-6 membered heterocyclyl containing up to two heteroatoms selected from N, O and S as ring members are each optionally substituted with up to three groups selected from halo, hydroxy, CN, R 10, -(CH 2) 0-2 OR 10, -SR 10, -S R 10,-SO 2 R 10, -S R 10, and -(CH 2) 0-2 N(R 10) 2; where each R 10 is independently H or C 1-4 alkyl optionally substituted with one or two groups selected from amino, hydroxy, C 1-4 alkoxy, and CN; and -N(R 10) 2 can represent a 5-6 membered heterocyclic ring optionally containing an additional heteroatom selected from N, O and S as a ring member, and optionally substituted with one or two groups selected from oxo, halo, hydroxy, C 1-4 alkyl, C 1-4 alkoxy, and amino. Z is N or CR 1, where R 1 is selected from H, halo, C 1-4 alkyl and C 1-4 haloalkyl; R 2 and R 3 are independently selected from C 1-4 alkyl and C 1-4 haloalkyl, R 4 is H or C 1-4 alkyl; X is selected from H, halo, C 1-4 alkyl, C 1-4 haloalkyl, and CN; L is selected from -C≡C-, -CR 5 =CR 6 -, -O-, -S-, and a direct bond between A and the ring containing Z; R 5 and R 6 are independently selected from H, halo, C 1-4 alkyl, and C 1-4 haloalkyl; and A is halo, CN, or an optionally substituted group selected from C 1-4 alkyl, C 3-6 cycloalkyl, phenyl, C 2-6 alkenyl, C 2-6 alkynyl, 5-6 membered heteroaryl containing up to four heteroatoms selected from N, O and S as ring members, and 4-6 membered heterocyclyl containing up to two heteroatoms selected from N, O and S as ring members, wherein the C 1-4 alkyl, C 3-6 cycloalkyl, phenyl, C 2-6 alkenyl, C 2-6 alkynyl, 5-6 membered heteroaryl containing up to four heteroatoms selected from N, O and S as ring members, and 4-6 membered heterocyclyl containing up to two heteroatoms selected from N, O and S as ring members are each optionally substituted with up to three groups selected from halo, hydroxy, CN, R 10, -(CH 2) 0-2 OR 10, -SR 10, -S R 10,-SO 2 R 10, -S R 10, and -(CH 2) 0-2 N(R 10) 2; where each R 10 is independently H or C 1-4 alkyl optionally substituted with one or two groups selected from amino, hydroxy, C 1-4 alkoxy, and CN; and -N(R 10) 2 can represent a 5-6 membered heterocyclic ring optionally containing an additional heteroatom selected from N, O and S as a ring member, and optionally substituted with one or two groups selected from oxo, halo, hydroxy, C 1-4 alkyl, C 1-4 alkoxy, and amino.