Added better logging