more resturc
more cleanup and fixes after restructuring