The invention provides compounds, pharmaceutical compositions comprising such compounds and methods of using such compounds to treat or prevent diseases or disorders associated with the activity of GPR119; such as, but not limited to, diabetes, obesity and associated metabolic disorders. Formula (I) is a compound, in which A can have up to 2 ring -CH2- group substituted with -C(O)- and can be partially unsaturated with up to 2 double bonds; Wi and W2 are independently selected from CR10 and N; wherein R10 is selected from hydrogen and C1_6alkyl; Yi is selected from NRn, O and S; wherein Rn is selected from hydrogen and C1_ 6alkyl; Y2 and Y3 are independently selected from CH and N; Y4 is selected from CH2, OCH2 and NR15; wherein R15 is selected from hydrogen and C1_6alkyl; or the pharmaceutically acceptable salts thereof.