I appreciate you providing this, but why would you want to be executing this in the mercs thread? I dont see any code that requires it. You aren't using rgmercs helpers, you aren't using rgmercs state. Seems like a standalone script with extra steps.