Some work on memory leaks.
Removed all the memory leaks in Demo.