Some refactor code