Moving a function to utils