Use google proto buf to for name entities and refactor the code.