Added singleton pattern in MemorySnapshotHandler.
Able to sort by labels. Passed test 1 for sortByLabels().