Added extract function