interim commit, cleanup mostly with RAII