Removed global references in main()