cleanup
sort triggers for easier debugging
allow spaces in place of underscores
better support for trigger variations