moved functionality to controlsystem, added memory control to
controlsystem destructor