Just a suggestion.
As you've stated early that the code relies on ops hashtable for checking trigger, it would be nice if you also provide the code to manage it. For example: code to add/remove a user to/from ops hashtable.
Without that, the script will simply not working especially for newbie in scripting.