facotored out code into tutorial_utils