How did the monks help the government in medieval times?