cleaned up dirty pointer handling -> global priv struct