Rewrote extract, now a bazillion times faster