added full end checking
added trigger logic