minor optimization changes