Added new logging code