For number 3, you could check the creation time and filter your list of displayed (or used/loaded) files.
I would agree with @ahuang11: using a class will allow you keep track of the state. Otherwise, your ds
will just vanish into memory nirvana.
If you post your full code, maybe the community can have a look and give you some hints.