Added history logging functionality.