A compound of formula or a pharmaceutically acceptable salt thereof, wherein: W, X, Y and Z are each independently selected from CH or N; Q is NR b; Q 1 is a bond; A is optionally substituted bicyclic aryl or optionally substituted bicyclic heteroaryl; L is a bond, -C -, -(CR c R c) m -, -OC -, -(CR c R c) m -OC -, -(CR c R c) m -C -, -NR b C -, or -NR b C - (wherein the point of the attachment to R 1 is on the left-hand side); R 1 is selected from alkyl, carbocycle, aryl, heteroaryl, and heterocyclyl; each of which is substituted with 0-5 occurrences of R d; each R 3 is independently selected from halo, haloalkyl, alkyl, hydroxyl and -OR a, or two adjacent R 3 taken together with the carbon atoms to which they are attached form an optionally substituted heterocyclyl; each R 4 is independently selected from halo, haloalkyl, alkyl, hydroxyl, =O, -OR a and phenyl, or two R 4 taken together with the carbon atoms to which they are attached form a bridged, fused or spyro-fused carbocycle, an aryl or a heteroaryl; each R a is independently selected from alkyl, acyl, hydroxyalkyl and haloalkyl; each R b is independently selected from hydrogen and alkyl; each R c is independently selected from hydrogen, halo, alkyl, alkoxy and halo alkoxy or two R c taken together with the carbon atoms to which they are attached form an optionally substituted cycloalkyl; each R d is independently selected from halo, haloalkyl, haloalkoxy, alkyl, alkynyl, nitro, cyano, hydroxyl, -C R a, -OC R a, -C OR a, -SR a, -NR a R b and-OR a, or two R d taken together with the carbon atoms to which they are attached form an optionally substituted heterocyclyl; n is 0, 1, or 2; m is 1, 2 or 3; h is 0, 1, 2; g is 0, 1 or 2; the sum of g + h is equal to or greater than 2; and p is 1 or 2, wherein the substituents of the optionally substituted bicyclic aryl, optionally substituted bicyclic heteroaryl, optionally substituted cycloalkyl and optionally substituted heterocyclyl are selected from the group consisting of: halo, -C≡N, C 1 -C 4 alkyl, =O, C 3 -C 7 carbocycle (e.g., cycloalkyl), C 1 -C 4 alkyl, -OH, -O-(C 1 -C 4 alkyl), -SH, -S-(C 1 -C 4 alkyl), -(C 1 -C 4 alkyl)-N(R b')(R b'), -N(R b')(R b'), -O-(C 1 -C 4 alkyl)-N(R b')(R b'), -(C 1 -C 4 alkyl)-O-(C 1 -C 4 alkyl)-N(R b')(R b'),-C -O(R b'), -OC (R b'), -O-C -O(R b'), -C -N(R b')(R b'), -N(R b')-C R b', -N(R b')C N(R b')(R b'), -N(R b')-S 1-2 R b', -S 1-2 N( R b')( R b'),-N(R b')S 1-2 N(R b')(R b'), -(C 1 -C 4 alkyl)-C -N(R b')(R b'), -O-(heteroaryl), -O-(heterocycle), -O-phenyl, -heteroaryl, -heterocycle, and -phenyl, wherein: each R b' is independently selected from hydrogen, -C 1 -C 4 alkyl, carbocycle, carbocyclylalkyl, aryl, aralkyl, heteroaryl, heteroaralkyl, heterocyclyl, or heterocyclylalkyl; or two R b' are taken together with the nitrogen atom to which they are bound to form a 4- to 8-membered saturated heterocycle optionally comprising one additional heteroatom selected from N, S, S(=O), S(=O) 2, and O, any alkyl substituent is optionally further substituted with one or more of -OH,-O-(C 1 -C 4 alkyl), halo, -NH 2, -NH(C 1 -C 4 alkyl), or -N(C 1 -C 4 alkyl) 2; and any carbon atom on a phenyl, carbocycle (e.g., cycloalkyl), heteroaryl or heterocycle substituent is optionally further substituted with one or more of -(C 1 -C 4 alkyl),-(C 1 -C 4 fluoroalkyl), -OH, -O-(C 1 -C 4 alkyl), -O-(C 1 -C 4 fluoroalkyl), halo,-NH 2, -NH(C 1 -C 4 alkyl), or -N(C 1 -C 4 alkyl) 2. W, X, Y and Z are each independently selected from CH or N; Q is NR b; Q 1 is a bond; A is optionally substituted bicyclic aryl or optionally substituted bicyclic heteroaryl; L is a bond, -C -, -(CR c R c) m -, -OC -, -(CR c R c) m -OC -, -(CR c R c) m -C -, -NR b C -, or -NR b C - (wherein the point of the attachment to R 1 is on the left-hand side); R 1 is selected from alkyl, carbocycle, aryl, heteroaryl, and heterocyclyl; each of which is substituted with 0-5 occurrences of R d; each R 3 is independently selected from halo, haloalkyl, alkyl, hydroxyl and -OR a, or two adjacent R 3 taken together with the carbon atoms to which they are attached form an optionally substituted heterocyclyl; each R 4 is independently selected from halo, haloalkyl, alkyl, hydroxyl, =O, -OR a and phenyl, or two R 4 taken together with the carbon atoms to which they are attached form a bridged, fused or spyro-fused carbocycle, an aryl or a heteroaryl; each R a is independently selected from alkyl, acyl, hydroxyalkyl and haloalkyl; each R b is independently selected from hydrogen and alkyl; each R c is independently selected from hydrogen, halo, alkyl, alkoxy and halo alkoxy or two R c taken together with the carbon atoms to which they are attached form an optionally substituted cycloalkyl; each R d is independently selected from halo, haloalkyl, haloalkoxy, alkyl, alkynyl, nitro, cyano, hydroxyl, -C R a, -OC R a, -C OR a, -SR a, -NR a R b and-OR a, or two R d taken together with the carbon atoms to which they are attached form an optionally substituted heterocyclyl; n is 0, 1, or 2; m is 1, 2 or 3; h is 0, 1, 2; g is 0, 1 or 2; the sum of g + h is equal to or greater than 2; and p is 1 or 2,