extract a function