Changed parameter to -std=c++0x' for compiler backwards compatibility
Fixed some memory leaks and fixed memory corruption problem. I was using shared_ptr wrong