Move all this code to the 'util' package