glstate code cleanup