Code cleanup
Updating tutorial and fixing bugs