Added extract function.