Major refactor of trigger system

A bit basic and still needs some work.