Utility function works correctly (hopefully).