The cyclization of a mixture of ethyl mercaptoacetate (I) and ethyl cyanacetate (II) by means of sodium ethoxide in ethanol gives ethyl 4-oxo-2-thiazolidinylideneacetate (III), which is methylated with sodium methoxide and methyl iodide yielding the N-methyl analog (IV). Bromination of (IV) with Br2 in chloroform affords the 5-bromo derivative (V), which is finally treated with piperidine (VI) in benzene.