code clean and refactor