finished refactor of trigger management