Added logging functionality