misc cleanup and one code change