added a few delete calls and initialization by 'new' for arrays