split into different files, added destructors