Updated to allow $this in a closure when closure is in class context