Moved unility functions into their own file.