Define helpers to return unique database and collection names.
Moved setting up a cluster into its own function.
Split logic of runFsmThreads into multiple functions.