A compound of formula I or pharmaceutically acceptable salts thereof, wherein X is -CH 2 -; -O-; -S n - or -NR c -, wherein n is from 0 to 2 and R c is hydrogen or alkyl; D is an optional oxygen; R 1 is alkyl; alkenyl; cycloalkyl; cycloalkenyl; halo; haloalkyl or hydroxyalkyl; R 2, R 3, and R 4 each independently is hydrogen; alkyl; alkenyl; amino; halo; amido; haloalkyl; alkoxy; hydroxy; haloalkoxy; nitro; amino; hydroxyalkyl; alkoxyalkyl; hydroxyalkoxy; alkynylalkoxy; alkylsulfonyl; arylsulfonyl; cyano; aryl; heteroaryl; heterocyclyl; heterocyclylalkoxy; aryloxy; heteroaryloxy; aralkyloxy; heteroaralkyloxy; optionally substituted phenoxy; -C≡C-R a; -(CH 2) m - n - -R b;-(CH 2) m - n -SO 2 -(NR c) n -R b, wherein m and n each independently is 0 or 1, Z is O or NR c, R a is hydrogen; alkyl; aryl;aralkyl; heteroaryl; heteroaralkyl; hydroxyalkyl,; alkoxyalkyl; alkylsulfonylalkyl; aminoalkyl; cyanoalkyl; alkylsilyl, cycloalkyl, cycloalkylalkyl; heterocyclyl; and heterocyclylalkyl; R b is hydrogen, alkyl, hydroxy, alkoxy, amino, hydroxyalkyl or alkoxyalkyl, and each R c is independently hydrogen or alkyl; or R 2 and R 3 together with the atoms to which they are attached may form a five or six-membered ring that optionally includes one or two heteroatoms selected from O, S and N; R 5 is hydrogen; alkyl; aryl; aralkyl; heteroaryl; heteroaralkyl; hydroxyalkyl; alkoxyalkyl; alkylsulfonylalkyl; aminoalkyl; cyanoalkyl; alkylsilyl, cycloalkyl, cycloalkylalkyl; heterocycl; or heterocyclylalkyl; R 6 is hydrogen; alkyl; halo; haloalkyl; amino; or alkoxy; and R 7 and R 8 each independently is hydrogen; alkyl; alkoxyalkyl; aminoalkyl; aminosulfonyl; cycloalkyl; cycloalkylalkyl; haloalkyl; haloalkoxy; hydroxyalky; alkoxyalkyl; alkylsulfonyl; alkylsulfonylalkyl; aminocarbonyloxyalkyl; hydroxycarbonylalkyl; hydroxyalkyloxycarbonylalkyl; aryl; aralkyl; arylsulfonyl; heteroaryl; heteroarylalkyl; heteroarylsulfonyl; heterocyclyl; or heterocyclylalkyl. X is -CH 2 -; -O-; -S n - or -NR c -, wherein n is from 0 to 2 and R c is hydrogen or alkyl; D is an optional oxygen; R 1 is alkyl; alkenyl; cycloalkyl; cycloalkenyl; halo; haloalkyl or hydroxyalkyl; R 2, R 3, and R 4 each independently is hydrogen; alkyl; alkenyl; amino; halo; amido; haloalkyl; alkoxy; hydroxy; haloalkoxy; nitro; amino; hydroxyalkyl; alkoxyalkyl; hydroxyalkoxy; alkynylalkoxy; alkylsulfonyl; arylsulfonyl; cyano; aryl; heteroaryl; heterocyclyl; heterocyclylalkoxy; aryloxy; heteroaryloxy; aralkyloxy; heteroaralkyloxy; optionally substituted phenoxy; -C≡C-R a; -(CH 2) m - n - -R b;-(CH 2) m - n -SO 2 -(NR c) n -R b, wherein m and n each independently is 0 or 1, Z is O or NR c, R a is hydrogen; alkyl; aryl;aralkyl; heteroaryl; heteroaralkyl; hydroxyalkyl,; alkoxyalkyl; alkylsulfonylalkyl; aminoalkyl; cyanoalkyl; alkylsilyl, cycloalkyl, cycloalkylalkyl; heterocyclyl; and heterocyclylalkyl; R b is hydrogen, alkyl, hydroxy, alkoxy, amino, hydroxyalkyl or alkoxyalkyl, and each R c is independently hydrogen or alkyl; or R 2 and R 3 together with the atoms to which they are attached may form a five or six-membered ring that optionally includes one or two heteroatoms selected from O, S and N; R 5 is hydrogen; alkyl; aryl; aralkyl; heteroaryl; heteroaralkyl; hydroxyalkyl; alkoxyalkyl; alkylsulfonylalkyl; aminoalkyl; cyanoalkyl; alkylsilyl, cycloalkyl, cycloalkylalkyl; heterocycl; or heterocyclylalkyl; R 6 is hydrogen; alkyl; halo; haloalkyl; amino; or alkoxy; and R 7 and R 8 each independently is hydrogen; alkyl; alkoxyalkyl; aminoalkyl; aminosulfonyl; cycloalkyl; cycloalkylalkyl; haloalkyl; haloalkoxy; hydroxyalky; alkoxyalkyl; alkylsulfonyl; alkylsulfonylalkyl; aminocarbonyloxyalkyl; hydroxycarbonylalkyl; hydroxyalkyloxycarbonylalkyl; aryl; aralkyl; arylsulfonyl; heteroaryl; heteroarylalkyl; heteroarylsulfonyl; heterocyclyl; or heterocyclylalkyl.