If you did the other changes suggested then the logic here would be a bit different. You'd first create a ReplayBus then you'd pass it to the SparkUI then you'd call the utility function and pass in the logdir to the bus. That seems a bit more modular to me.