cleanup
removed obsolete funcs
removed POINTER AND G globals
removed POINTER AND G globals