Fixed another leak and simplified code.