added proper cleanup