put advance function vars into a closure