Minor performance/memory improvements