modernize code, making more use of inference