Remove globals to enable unit testing