memory improvements

Avoid some object creation