for instance , the invention of the cotton gin , a machine that separates seeds from cotton fibers , greatly increased the profitability of cotton farming , and thus the need for slave labor , at a time when the institution was on the wane .