Extracting some util functions into its own file