Refactor and add key id information