Some Changes to memmanagment