Implement extract method with tests