more cleanup and one malloc less.