Move some util functions into the repo