more cleanup and re-arranging