added trigger code