Now freeing all allocated resources.

Another memory leak closed. Hopefully the last one.
Fixed up a few things in CMake config.
Added options and auto reply.