Added memwatch to headers and fixed memory leaks.