refactor code and final touch