Added lots of extra logging to try and see why the system does not work.