Code clean and refactor