extracting function