added automatic cleanup