make the main loop a while() instead of a for() as I find this (much) easier to read this way)