added extract function