clean up mostly and raii