trigger function implemented and tested