Moved utility function