replaced explicit temp types with auto