use shelve to store ids