helper function updated