Controlling the spread of a class of epidemics