added trigger, removed old code
added support for triggering rules