Code cleanup, fixed memory leak on exit.