Refactored: simpler and more robust

Now you can retry processing if you get an exception and it will start again where it left off.