memory management improvements/tagged 0.3.1