Added some logging code