updated doc and wrapper function to closure