Fixed memory leaks, cleaned debug messsages

Thanks, Valgrind!
Fixed printout.

Whoops. Silly auto-completion error.