Added a bit of logging here and there