Porting a lot of the functionality from the wh_tutorial branch to this branch.