Add some documentation
Add memory management