Added logging functionality.