some clean and refactor