Add a nested utility function