Cleanup global code a bit