refactor code test1-6