Slight allocation optimizations. Also another cleanup round.