extended tutorial. fixed some bugs