A compound of formula wherein n is 0,1, 2, 3, 4, 5 or 6; ring B is an optionally substituted 5- or 6- membered aryl or heteroaryl group wherein each substitutable carbon or heteroatom in Ring B is optionally and independently substituted by one or more R 3; W is selected from a hydrocarbyl optionally substituted with R 11, an optionally substituted aryl or heteroaryl group and a carbocyclyl optionally substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy groups; X is selected from a hydrocarbyl optionally substituted with R 11 and a carbocyclyl optionally substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy groups; wherein one of W and X may be absent; R 1, R 2, R 3, R 4 and R 5 are independently selected from hydrogen, R 12, hydrocarbyl optionally substituted with R 12, and -(CH 2) 1 -heterocyclyl optionally substituted with R 12; wherein R 1 and R 2 taken together with the atoms to which they are attached may form a heterocycle, optionally substituted with one or more R 12; wherein R 1 and/or R 2 taken together with W or X may form a heterocycle optionally substituted with one or more R 12; and wherein one or more of R 3 and R 5 taken together with the atoms to which they are attached may form a carbocycle, for example heterocyclyl, optionally substituted with R 12; 1 is 0, 1, 2, 3, 4, 5 or 6; wherein each R 11 and R 12 is independently selected from halogen, trifluoromethyl, cyano, thio, nitro, oxo, =NR 13, -OR 13, -SR 13, -C R 13, -C OR 13, -OC R 13,-NR 13 COR 14, -NR 13 CONR 13 2, -NR 13 COR 14, -NR 13 CO 2 R 14, -S R 13, -S 2 R 13,-SONR 13 2, -NR 13 S 2 R 14; -CSR 13, -N(R 13)R 14, -C N(R 13)R 14, _SO 2 N(R 13)R 14 and R 15; wherein R 13 and R 14 are each independently selected from hydrogen or R 15; wherein R 15 is selected from hydrocarbyl, carbocyclyl and -(CH 2) m -heterocyclyl, and each R 15 is optionally and independently substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy; m is 0, 1, 2, 3, 4, 5 or 6; p is 0, 1, 2, 3 or 4; wherein the values of R 4 may be the same or different; q is 0, 1, 2, 3 or 4; wherein the values of R 5 may be the same or different; or a pharmaceutically acceptable salt thereof. n is 0,1, 2, 3, 4, 5 or 6; ring B is an optionally substituted 5- or 6- membered aryl or heteroaryl group wherein each substitutable carbon or heteroatom in Ring B is optionally and independently substituted by one or more R 3; W is selected from a hydrocarbyl optionally substituted with R 11, an optionally substituted aryl or heteroaryl group and a carbocyclyl optionally substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy groups; X is selected from a hydrocarbyl optionally substituted with R 11 and a carbocyclyl optionally substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy groups; wherein one of W and X may be absent; R 1, R 2, R 3, R 4 and R 5 are independently selected from hydrogen, R 12, hydrocarbyl optionally substituted with R 12, and -(CH 2) 1 -heterocyclyl optionally substituted with R 12; wherein R 1 and R 2 taken together with the atoms to which they are attached may form a heterocycle, optionally substituted with one or more R 12; wherein R 1 and/or R 2 taken together with W or X may form a heterocycle optionally substituted with one or more R 12; and wherein one or more of R 3 and R 5 taken together with the atoms to which they are attached may form a carbocycle, for example heterocyclyl, optionally substituted with R 12; 1 is 0, 1, 2, 3, 4, 5 or 6; wherein each R 11 and R 12 is independently selected from halogen, trifluoromethyl, cyano, thio, nitro, oxo, =NR 13, -OR 13, -SR 13, -C R 13, -C OR 13, -OC R 13,-NR 13 COR 14, -NR 13 CONR 13 2, -NR 13 COR 14, -NR 13 CO 2 R 14, -S R 13, -S 2 R 13,-SONR 13 2, -NR 13 S 2 R 14; -CSR 13, -N(R 13)R 14, -C N(R 13)R 14, _SO 2 N(R 13)R 14 and R 15; wherein R 13 and R 14 are each independently selected from hydrogen or R 15; wherein R 15 is selected from hydrocarbyl, carbocyclyl and -(CH 2) m -heterocyclyl, and each R 15 is optionally and independently substituted with one or more of halogen, cyano, amino, hydroxy, C 1-6 alkyl and C 1-6 alkoxy; m is 0, 1, 2, 3, 4, 5 or 6; p is 0, 1, 2, 3 or 4; wherein the values of R 4 may be the same or different; q is 0, 1, 2, 3 or 4; wherein the values of R 5 may be the same or different; or a pharmaceutically acceptable salt thereof.