added timeout to extract function