add flatten + cleanup