Updated helper function.