adding history logging triggers and functions