Rewrote main loop using loop macro