Extract util functions