Refactored extract2.