added a helper function

added a helper function