Cleanups/fix globals