Add comments to functions in memory.go