Added a significant amount of logging