add comments and license header
remove custom MemoryIndex, it is never reset anyway