new static util function and accompanying tests