Extract util function