completed tutotrial
refactor code