code refactor, changed to accept run id