TutorialDialog refactoring and dialog leaks #43 fix