some cleanup and minor changes