Reimplemented => with a captured variable, and changed tests because it seems that global != this at the top level.