Some more cleanup and fixes