Added memory tracking and buttons (not working yet)
Now the script tracks memory and rebuilds the list correspondingly.