Add internal logging
Merge remote-tracking branch 'origin/master' into debug