adding extract function