Revert "better memory management"

This reverts commit d7f4b12e33adc8dd29620188bc596a01ef1df3f3.