Consolidated variables in main loop