Added option to process memories from last to first