minor clean-up

fixed some warnings, a memory leak, some spelling mistakes, changed some things to a more idiomatic C++