some progress on trigger code