more cleanup
more flattening