Remember flag

This is now pretty much good to go. The code is still fairly complex, and I'd like to simplify the run method by introducing decorators around individual run calls, but that will have to wait for later. I am going to merge this into master for now after we test it on Rstudio today.