Added uids field to Shared and wrote code to cleanup uids on close