Add functions to get the next free id to use.