Some cleanup and fixes.