Added an extract function