refactor code 2.0