removed reliance on global pointer