Modified so function works inside the wrapper