Added a lot of logging