optimize memory reuse

finally!