split out util functions