Add id to all entries, including head and tail