captures enclosing function