Some code cleanup in tutorials