Morpholinyl compounds of formula (I) or a pharmaceutically acceptable salt thereof: wherein G is aryl or a 5-6 membered heteroaromatic or 8-11 membered heteroaromatic group, which may be benzofused or optionally substituted by 1-4 substituents selected from halogen, cyano, hydroxyl, amino, C1-4alkylamino, C1-4alkyl, haloC1-4alkyl, C1-4alkoxy, haloC1-4alkoxy, C1-4alkanoyl, SF5, C(=O)NH2 and C(=O)OR4; W is S, SO2, O, CHR2, NR4; n is 0 or 1; m and p are 1 or 2; z is 1-7; R and R4 are hydrogen or C1-4alkyl; R1 is hydrogen, C1-4alkyl; C1-4alkoxy; R2 and R3 are hydrogen, F, C1-4alkyl; OH, C1-4alkoxy; G1 is a phenyl group or a 5-6-membered heteroaromatic group or a 8-11 membered heteroaromatic group, optionally substituted by 1-4 substituents selected from halogen, cyano, hydroxyl, amino, C1-4alkylamino, C1-4alkyl, haloC1-4alkyl, C1-4alkoxy, C1-4alkanoyl, SF5, C(=O)NH2 or C(=O)OR4, C(=O)OR4; Y is H or an optionally substituted moiety selected from 5-6 membered heteroaromatic group, saturated mono 3-7 membered carbocyclic group or 8-11 membered bicyclic carbocyclic group in which one or more atom carbons may be replaced by NR4, O, S; may be useful as modulators of dopamine D3 receptors, e.g. to treat drug dependency or psychotic disorders such as schizophrenia.