Fixes for tutorials.  Refactoring.