Revert "Consolidated variables in main loop"

This reverts commit 3701326cd3ef36e7d1adfb63bc204ccb2418306a.