`mlcube run` function is too long and complex right now, needs to be refactored (without behavior change)