Revert "A little memory management changes etc"

This reverts commit 14ed37327de70a374159194b88142d927452dd0a.