extracting function
extracting common knowledge of two functions