once a child was apprenticed , he was bound legally to remain in service to the mill until he was twenty-oneor until the working conditions , overcrowded , ill-lit , ill-ventilated rooms , twelve-hour shifts , and frequently dangerous equipment put an end to the misery of his small existence .