Refactor knit_bootstrap to properly support RStudio