Made changes to improve logging