Improved find_unassigned script to use less memory with the 'shelve' module