Simplify memory handling