Enter loop rather than writing once and exiting