Some cleanup and minor changes