finish wrapping code in function closure