starting to put together the main loop