Added more logging functionality