Compounds are provided which are useful in treating disorders of gastrointestinal motility and which have the structureor a pharmaceutically acceptable salt thereof, a prodrug ester thereof, and all stereoisomers thereof,wherein R1 and R2 are the same or different and are independently selected from hydrogen, alkyl, aryl, cycloalkyl, alkenyl, alkynyl, arylalkyl, heteroaryl, heteroarylalkyl or heterocycloalkyl;Z is selected from —CON(R4)R4a, —CO2R4, —SO2N(R4)R4a, —SO2R4, CN, andR4 and R4a are the same or different and are independently selected from hydrogen, alkyl, cycloalkyl, aryl, arylalkyl, heteroaryl, or heteroarylalkyl or R4 and R4a can be joined together to form a heterocycle.R4b is selected from hydrogen, halogen, hydroxyl, CN, OCF3, CF3, CONH2, SONH2, SO2CH3, NHCOCH3 or NHCO2CH3; andQ is a substituted bicyclic heterocycle.A method for using such compounds for treating disorders of gastrointestinal motility is also provided.