Cleaned up globals and startup code (cosmetic changes only)