some refactorinng and tutuarial fix