Added sorting, start and end options to AddMemory.py