modify extract function