more small optimization changes