revised dispatcher queue implementation inspired by @stephenjudkins